(function() {
	$(function() {
		function f() {
			var i = $(".j_backTop");
			if (i.length > 0) {
				i.click(function() {
					window.scrollTo(0, 0)
				})
			}
		}
		function d(i) {
			if (typeof window.onscroll == "function") {
				var j = window.onscroll;
				window.onscroll = function() {
					j();
					i()
				}
			} else {
				window.onscroll = function() {
					i()
				}
			}
		}
		window.weiboRemindCallback = function(k) {
			if (typeof k.errno != "undefined") {
				return false
			} else {
				var i = document.querySelector("#j_weibo_remind"),
				j = parseInt(k.comment) + parseInt(k.message) + parseInt(k.notice) + parseInt(k.atmsg) + parseInt(k.atcmt) + parseInt(k.newfans);
				if (j > 0) {
					j = (j > 99) ? "99+": j;
					i.innerHTML = j;
					i.style.display = "block"
				}
			}
		};
		function h(p) {
			var m = null,
			o = $("#" + p),
			k = o.children().eq(0).find("img"),
			n = o.children().eq(1).find("li"),
			i = k.length,
			l = i - 2,
			j = 1;
			m = new Swipe(document.getElementById(p), {
				startSlide: 0,
				auto: 4000,
				speed: 300,
				callback: function(q, r) {
					n.removeClass("active").eq(q).addClass("active");
					if (j <= l) {
						if (q >= 1 && q <= l) {
							var t = k.eq(q + 1);
							if (t.length > 0) {
								var s = t.attr("data-src");
								t.attr("src", s)
							}
						}
						j++
					}
				}
			})
		}
		function g(l) {
			var j = null,
			k = $("#" + l),
			i = k.prev().find("li");
			j = new Swipe(document.getElementById(l), {
				startSlide: 0,
				speed: 300,
				callback: function(p, q) {
					if (i.length > 1) {
						var m = i.eq(p);
						i.removeClass("active");
						m.addClass("active");
						if (window.suda) {
							var r = k.prev(),
							o = r.data("sudaclick");
							if (o) {
								var s = m.html();
								var n = {
									type: "Tab",
									name: o,
									title: s,
									index: p + 1
								};
								if (window.suds_count) {
									window.suds_count(n)
								}
							}
						}
					}
				}
			});
			$(document).on("click tap", i,
			function() {
				if ($(this).hasClass("active")) {
					return
				}
				var m = i.index(this);
				j.slide(m, 200)
			});
			k.children().children().removeClass("hide")
		}
		function e() {
			var k = $(".j_tabSwipe"),
			j = k.length;
			if (j == 0) {
				return false
			}
			for (var l = 0; l < j; l++) {
				var m = "tabSwipe_" + l;
				k.eq(l).attr("id", m);
				g("tabSwipe_" + l)
			}
		}
		function a() {
			var l = $(".j_imgdelay"),
			i = l.length,
			k = 0;
			if (i == 0) {
				return false
			}
			var j = document.documentElement.clientHeight;
			j = j * 2;
			function n() {
				if (k >= i) {
					return false
				}
				for (var p = 0; p < i; p++) {
					var q = l.eq(p);
					if (q.data("imgdelay") === 1) {
						continue
					}
					var u = document.body.scrollTop || document.documentElement.scrollTop,
					s = j + u;
					if (q.offset().top < s) {
						var r = q.find("img"),
						t = r.length;
						for (var o = 0; o < t; o++) {
							var v = r.eq(o);
							v.attr("src", v.data("src"))
						}
						q.data("imgdelay", "1");
						k = k + 1
					}
				}
			}
			var m;
			d(function() {
				if (m) {
					clearTimeout(m)
				}
				m = setTimeout(n, 200)
			})
		}
		setTimeout(function() {
			h("imgSwipe");
			e();
			a();
			f()
		},
		300);
		setTimeout(function() {
			b()
		},
		1000)
	})
})();